TRAVERSE Global v11.1

Writing Formulas

The Payroll system has the ability to use formulas to calculate deductions, employer costs, local withholdings, and employer taxes based on earnings and tables. You can use Variables for numbers such as year-to-date amounts, gross earnings, and so on, which you can manipulate using Methods, Operations, and Functions, much like a spreadsheet program. You can also look up tax rates and other variable factors in formula tables.

The Payroll system uses formulas to calculate deductions and withholdings based on earnings and tables. These formulas involve variables, constants, operations, and functions.

  • Commands are functions that tell the formula what to do to retrieve a value.
  • Variables are an equivalent that stand for something which can change value as other actions occur.
  • Constants are positive or negative numbers.
  • Factors are a constant defined in a formula or in an employee or employer override factor. You can set up to six factors in each formula. Employee and employer formulas have up to six override factors.
  • Functions you can use three types of functions when constructing formulas: Table Lookups, Conditionals, and MIN/MAX functions.
  • Operations proceed according to standard mathematical rules. Multiplication and division are first performed. Addition and subtraction are performed afterwards. Functions within parentheses are performed before operations outside of parenthesis.

You can use positive or negative numbers (constants) in formulas. You can also use these variable which store payroll information values set by the Payroll system as it calculates the employee’s paycheck:

TRAVERSE uses Iron Python scripting for the scripting language to write the formulas. There are many books available as references to use when writing scripts. A summary of valid variables, operations, and functions follow. If you are new to formulas or you need to review them, several examples of formulas are available in this section.

Formula Tips

  • When setting up your formulas, you don’t need to type all the commands and variables into the formula. With the formula box open you can double click on the command and variable in the right column to bring the value double clicked on into the formula, and then add quotation marks and other text to the formula manually. The value double clicked on will be brought into the formula at the point of the cursor.
  • If your formula might result in a negative amount calculated use a line at the end of the formula similar to this:

    if L3 < 0:

       L4 = 0

    else:

       L4 = L3

    This formula line says if line 3 is less than zero then return 0 or else return the value from line 3.

  • If you are going to be using variable amounts that could change for each employee, use the factor fields and use the (“FCx”) function (x being the value 1 to 6 corresponding to the factor fields).
  • When using the conditional if: else: make sure to put a colon after the if statement and after the else command. When defining the then, the line after the if, and when defining the else, the line after the else, be consistent with the number of spaces used to indent the conditional values. In this sample above, 3 spaces are used for each of the if, then, else conditional statements.
  • When using the #tax methods commands the variable, and factors must be enclosed in quotation marks within the parentheses (“ADJEARN”).
  • When bringing in line number values into another line the line numbers are not enclosed in parentheses or quotation marks. For example: L9 = L6 - L8
  • Line numbers can be defined in many different ways within the formulas. The line number is defined by putting an equal sign after the value you want to use for the line number. For example: L1 = would be defining line 1. y1 = would also be defining line 1 but using the y as a reference. When only one line is used you can use a character reference such as res = to define the line number as the result.
  • The last line in each formula must contain the f.SetNumericVariable command to return the value calculated. For example: f.SetNumericVariable(“CALCVALUE”, L4) is saying set the numeric variable to the calculated value from line 4, which is the last line defined in the formula.